<link rel="stylesheet" href="<%- Virtual_Path.Static %>main/css/activity-baoming.css"/>
<script src="<%- Virtual_Path.Static %>jquery.plugin/birthday/birthday.js"></script>
<div class="Baoming">
    <div class="Baoming-Wrap">
        <div class="Baoming-Content">
            <div class="Baoming-title">
                报名表
            </div>
            <div class="Baoming-form">
                <div class="form-content">

                    <div class="form-group">
                        <label for="" class="form-label">昵称：</label>
                        <div class="form-control">
                            <p class="form-text"  id="B_NickName">天霸动霸tua</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">姓名：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Name">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">年龄：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Age">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">身高：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Stature">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">出生日期：</label>
                        <div class="form-control">
                            <select name="Birthday_Year" id="sel_year" rel="" class="form-select"></select>
                            <select name="Birthday_Month" id="sel_month" rel="" class="form-select"></select>
                            <select name="Birthday_Day" id="sel_day" rel="" class="form-select"></select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">身份证号码：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Card">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">工作单位：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Work">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">籍贯：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Native">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">最高学历:</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Education">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">毕业院校:</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_School">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">身体是否健康: </label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio" name="B_Health" value="1">是</label>
                            <label for="" class="form-radio"><input type="radio" name="B_Health" value="2">否</label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">婚恋状况:</label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio" name="Love" value="1">单身</label>
                            <label for="" class="form-radio"><input type="radio" name="Love" value="2">恋爱中</label>
                            <label for="" class="form-radio"><input type="radio" name="Love" value="3">已婚</label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">首次冲关:</label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio" name="Isone" value="1">是</label>
                            <label for="" class="form-radio"><input type="radio" name="Isone" value="2">否</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="form-label">上传照片:</label>
                        <div class="form-control">
                            <input type="file" id="B_Event_Photos">
                        </div>
                    </div>
                </div>
                <div class="form-content">
                    <div class="form-group">
                        <label for="" class="form-label">性别：</label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio" value="1" name="B_Sex" >男</label>
                            <label for="" class="form-radio"><input type="radio" value="2" name="B_Sex">女</label>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">职业：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Job">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">体重：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Weight">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">生肖：</label>
                        <div class="form-control">
                            <select name="Zodiac" id="B_Zodiac" class="form-select">
                                <option value="鼠" >鼠</option>
                                <option value="牛">牛</option>
                                <option value="虎">虎</option>
                                <option value="兔">兔</option>
                                <option value="龙">龙</option>
                                <option value="蛇">蛇</option>
                                <option value="马">马</option>
                                <option value="羊">羊</option>
                                <option value="猴">猴</option>
                                <option value="鸡">鸡</option>
                                <option value="狗">狗</option>
                                <option value="猪">猪</option>
                            </select>

                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">联系方式：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Phone">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">民族：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Nation">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">现居地：</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Residence">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">居住时间:</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Dwelling_Time">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">专业:</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Major">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="form-label">特长:</label>
                        <div class="form-control">
                            <input type="text" class="form-input" id="B_Specialty">
                        </div>
                    </div>

                    <div class="form-group form-wauto">
                        <label for="" class="form-label">有无心脏病史: </label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio"  name="Heart" value="1" >有</label>
                            <label for="" class="form-radio"><input type="radio" name="Heart" value="2">无</label>
                        </div>
                    </div>

                    <div class="form-group form-wauto">
                        <label for="" class="form-label">晋级之后是否愿意参加晋级赛、决赛:</label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio" name="Promotion" value="1">是</label>
                            <label for="" class="form-radio"><input type="radio" name="Promotion" value="2">否</label>
                        </div>
                    </div>

                    <div class="form-group form-wauto">
                        <label for="" class="form-label">是否参加过电视节目或类似运动:</label>
                        <div class="form-control">
                            <label for="" class="form-radio"><input type="radio"   name="JoinTv" value="1">是</label>
                            <label for="" class="form-radio"><input type="radio" name="JoinTv" value="2">否</label>
                        </div>
                    </div>
                </div>
                <div class="form-button">
                    <button class="form-submit" type="button" id="B_Sign_Up">点击报名</button>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="UploadifiveQueue"></div>
<script src="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/jquery.uploadifive.min.js"></script>
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/uploadifive.css">
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/uploadifive.custom.css">
<script>
    $(function () {
        var Imgurl='';
        if (!_StateData.IsLogin) {
            $.KOC.Tips.Open('Error', '请先登录', {Timeout: 1000});
            location.href = '/';
        }
        //时间搜索插件
        $.ms_DatePicker({
            YearSelector: ".sel_year",
            MonthSelector: ".sel_month",
            DaySelector: ".sel_day",
        });
        $.ms_DatePicker();
        $("#B_NickName").html(_StateData.NickName);
        ////////////////////////////////////
        //生活照上传
        ////////////////////////////////////
        $('#B_Event_Photos').uploadifive({
            'uploadScript': _VirtualPath.Utils + 'service/fileupload',
            'removeCompleted': true,
            'queueID': 'UploadifiveQueue',
            'multi': false,
            'buttonClass': '',
            'buttonText': '生活照上传',
            'fileType': 'image/*',
            'onUploadComplete': function (file, data) {
                data = $.parseJSON(data);
                if (data.flag !== 0) {
                    $.KOC.Tips.Open("Error", "上传文件出错，请重试！", {Timeout: 1000});
                    return;
                }
                $.ajax({
                    url: "/ajax/base.user-eventimg",
                    type: "post",
                    dataType: "json",
                    data: {
                        FileName: data.FileName,
                        Front: "a"
                    },
                    success: function (data) {
                        Imgurl=data.path;
                    }
                });
            }
        });
        $('#B_Sign_Up').on('click',function () {
            var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
            var tel = /^0?(13[0-9]|15[012356789]|18[0123456789]|17[0123456789]|14[57])[0-9]{8}$|^[a-zA-Z0-9][a-zA-Z0-9._-]*\@[a-zA-Z0-9]+\.[a-zA-Z0-9\.]+$/;
            var _num = /^[0-9]*$/;
            var parms={};
            parms.NickName=_StateData.NickName;
            parms.RealName=$.trim($('#B_Name').val());//姓名
            parms.Sex=$("input[name='B_Sex']:checked").val();//性别
            parms.Nation=$.trim($('#B_Nation').val());//民族
            parms.NativePlace=$.trim($('#B_Native').val());//籍贯
            parms.Profession=$.trim($('#B_Job').val());//职业
            parms.Major=$.trim($('#B_Major').val());//专业
            parms.Age=$.trim($('#B_Age').val());//年龄
            parms.Height=$.trim($('#B_Stature').val());//身高
            parms.Weight=$.trim($('#B_Weight').val());//体重
            parms.Sel_Year=$.trim($('#sel_year').val());//年
            parms.Sel_Month=$.trim($('#sel_month').val());//月
            parms.Sel_Day=$.trim($('#sel_day').val());//日
            parms.Birthday=$.trim($('#sel_year').val())+'-'+$.trim($('#sel_month').val())+'-'+$.trim($('#sel_day').val());//生日
            parms.Animal=$.trim($("#B_Zodiac").val());//生肖
            parms.IDCard=$.trim($('#B_Card').val());//身份证号
            parms.Phone=$.trim($('#B_Phone').val());//联系方式
            parms.Education=$.trim($('#B_Education').val());//最高学历
            parms.School=$.trim($('#B_School').val());//毕业院校
            parms.WorkUnit=$.trim($('#B_Work').val());//工作单位
            parms.Address=$.trim($('#B_Residence').val());//现住地
            parms.LiftTime=$.trim($('#B_Dwelling_Time').val());//居住时间
            parms.Healths=$("input[name='B_Health']:checked").val();//是否健康
            parms.Marriage=$("input[name='Love']:checked").val();//是否婚姻
            parms.FirstGo=$("input[name='Isone']:checked").val();//是否首次冲关
            parms.HeartDiseaseHistory=$("input[name='Heart']:checked").val();//是否有心脏病是
            parms.ContinueGame=$("input[name='Promotion']:checked").val();//晋级之后是否愿意继续比赛
            parms.SimilarPrograms=$("input[name='JoinTv']:checked").val();//是否参见过电视节目
            parms.Speciality=$.trim($('#B_Specialty').val());//特长
            parms.ImageUrl=Imgurl;//图片地址
            if (!parms.RealName) {
                $.KOC.Tips.Open('', '请输入姓名', {Timeout: 1000});
                $('#B_Name').focus();
                return ;
            }
            if (!parms.Sex) {
                $.KOC.Tips.Open('', '请选择性别', {Timeout: 1000});
                return ;
            }
            if (!parms.Nation) {
                $.KOC.Tips.Open('', '请输入民族', {Timeout: 1000});
                $('#B_Nation').focus();
                return ;
            }
            if (!parms.NativePlace) {
                $.KOC.Tips.Open('', '请输入籍贯', {Timeout: 1000});
                $('#B_Native').focus();
                return ;
            }
            if (!parms.Profession) {
                $.KOC.Tips.Open('', '请输入职业', {Timeout: 1000});
                $('#B_Job').focus();
                return ;
            }
            if (!parms.Major) {
                $.KOC.Tips.Open('', '请输入专业', {Timeout: 1000});
                $('#B_Major').focus();
                return ;
            }
            if (!parms.Age) {
                $.KOC.Tips.Open('', '请输入年龄', {Timeout: 1000});
                $('#B_Age').focus();
                return ;
            }else if(!_num.test(parms.Age)){
                $.KOC.Tips.Open("", '年龄请输入纯数字！', {Timeout: 1000});
                return;
            }
            if (!parms.Height) {
                $.KOC.Tips.Open('', '请输入身高', {Timeout: 1000});
                $('#B_Stature').focus();
                return ;
            }else if(!_num.test(parms.Height)){
                $.KOC.Tips.Open("", '身高请输入纯数字！', {Timeout: 1000});
                return;
            }
            if (!parms.Weight) {
                $.KOC.Tips.Open('', '请输入体重', {Timeout: 1000});
                $('#B_Weight').focus();
                return ;
            }else if(!_num.test(parms.Weight)){
                $.KOC.Tips.Open("", '体重请输入纯数字！', {Timeout: 1000});
                return;
            }
            if (parms.Sel_Year == '0') {
                $.KOC.Tips.Open('', '请选择年份', {Timeout: 1000});
                return ;
            }
            if (parms.Sel_Month == '0') {
                $.KOC.Tips.Open('', '请选择月份', {Timeout: 1000});
                return ;
            }
            if (parms.Sel_Day == '0') {
                $.KOC.Tips.Open('', '请选择日', {Timeout: 1000});
                return ;
            }
            if (!parms.IDCard) {
                $.KOC.Tips.Open('', '请输入身份证号', {Timeout: 1000});
                $('#B_Card').focus();
                return ;
            }else if(!regIdCard.test(parms.IDCard)){
                $.KOC.Tips.Open('','你输入的身份证格式不对，请重新输入',{Timeout:1000});
                $('#B_Card').focus();
                return ;
            }
            if (!parms.Phone) {
                $.KOC.Tips.Open('', '请输入手机号', {Timeout: 1000});
                $('#B_Phone').focus();
                return ;
            }if(!tel.test(parms.Phone)){
                $.KOC.Tips.Open('','你输入的手机号格式不对，请重新输入',{Timeout:1000});
                $('#B_Phone').focus();
                return ;
            }
            if (!parms.Education) {
                $.KOC.Tips.Open('', '请输入最高学历', {Timeout: 1000});
                $('#B_Education').focus();
                return ;
            }
            if (!parms.School) {
                $.KOC.Tips.Open('', '请输入毕业学院', {Timeout: 1000});
                $('#B_School').focus();
                return ;
            }
            if (!parms.WorkUnit) {
                $.KOC.Tips.Open('', '请输入工作单位', {Timeout: 1000});
                $('#B_Work').focus();
                return ;
            }
            if (!parms.Address) {
                $.KOC.Tips.Open('', '请输入现居地', {Timeout: 1000});
                $('#B_Residence').focus();
                return ;
            }
            if (!parms.LiftTime) {
                $.KOC.Tips.Open('', '请输入居住时间', {Timeout: 1000});
                $('#B_Dwelling_Time').focus();
                return ;
            }
            if (!parms.Healths) {
                $.KOC.Tips.Open('', '请选择是否健康', {Timeout: 1000});
                return ;
            }
            if (!parms.Marriage) {
                $.KOC.Tips.Open('', '请选择婚恋状况', {Timeout: 1000});
                return ;
            }
            if (!parms.FirstGo) {
                $.KOC.Tips.Open('', '请选择首次冲关', {Timeout: 1000});
                return ;
            }
            if (!parms.HeartDiseaseHistory) {
                $.KOC.Tips.Open('', '请选择有无心脏病史', {Timeout: 1000});
                return ;
            }
            if (!parms.ContinueGame) {
                $.KOC.Tips.Open('', '请选择晋级之后是否愿意参加晋级赛、决赛', {Timeout: 1000});
                return ;
            }
            if (!parms.SimilarPrograms) {
                $.KOC.Tips.Open('', '请选择是否参加过电视节目或类似运动', {Timeout: 1000});
                return ;
            }
            if (!parms.Speciality) {
                $.KOC.Tips.Open('', '请输入特长', {Timeout: 1000});
                $('#B_Specialty').focus();
                return ;
            }
            if (!parms.ImageUrl) {
                $.KOC.Tips.Open('', '请上传生活照片', {Timeout: 1000});
                return ;
            }
            $.KOC.Loading.Open();
            $.ajax({
                url: '/ajax/business.user-justgoapply',
                type: 'post',
                dataType: 'json',
                data: {
                    NickName:parms.NickName,
                    RealName:parms.RealName,
                    Sex:parms.Sex,
                    Nation:parms.Nation,
                    NativePlace:parms.NativePlace,
                    Profession:parms.Profession,
                    Major:parms.Major,
                    Age:parms.Age,
                    Height:parms.Height,
                    Weight:parms.Weight,
                    Birthday:parms.Birthday,
                    Animal:parms.Animal,
                    IDCard:parms.IDCard,
                    Phone:parms.Phone,
                    Education:parms.Education,
                    School:parms.School,
                    WorkUnit:parms.WorkUnit,
                    Address:parms.Address,
                    LiftTime:parms.LiftTime,
                    Health:parms.Healths,
                    Marriage:parms.Marriage,
                    FirstGo:parms.FirstGo,
                    HeartDiseaseHistory:parms.HeartDiseaseHistory,
                    ContinueGame:parms.ContinueGame,
                    SimilarPrograms:parms.SimilarPrograms,
                    Speciality:parms.Speciality,
                    ImageUrl:parms.ImageUrl
                },
                success: function (data) {
                    $.KOC.Loading.Close();
                    if (data.flag !== 0) {
                        $.KOC.Tips.Open("", data.msg + "(" + data.flag + ")", {Timeout: 2000});
                        return;
                    }
                    $.KOC.Tips.Open('Success', '报名成功', {
                        Timeout: 3000,
                        onClose: function () {
                            var url = "/";
                            location.href = url;
                        }
                    });

                }
            });


        });
    })
</script>